﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Product.ascx.cs" Inherits="Admin_Components_MasterData_Product" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True"></telerik:RadScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:radformdecorator id="QsfFromDecorator" runat="server" decoratedcontrols="All"
        enableroundedcorners="false" />
    <telerik:RadTabStrip ID="TabStrip1" runat="server" EnableDragToReorder="true" Skin="Vista" MultiPageID="RadMultiPag1" SelectedIndex="1">
        <Tabs>
            <telerik:RadTab Text="TẠO MỚI" Selected="True" ></telerik:RadTab>
             <telerik:RadTab Text="TÌM KIẾM"></telerik:RadTab>
            <telerik:RadTab Text="ĐỊNH NGHĨA GIÁ BÁN"></telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
<telerik:RadMultiPage ID="RadMultiPag1" runat="server" SelectedIndex="0">
        <!--Tab thông tin chung -->
        <telerik:RadPageView ID="RadPageView1" runat="server" Style="overflow: hidden">
                <fieldset class="form" id="fsGeneral" >
                <br />
    <div class="form-horizontal wrapper-center clearfix">
        <!--Block bên trái -->
    <div class="form-group col-md-6">
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label">
                Mã sản phẩm <span style="color:red;">(*)</span></label>
            <div class="col-md-8">
                <telerik:RadTextBox ID="txtProductCode" CssClass="col-imp-5 inputForm"  runat="server" readOnly= "true" />
            </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label">
                Thuộc loại <span style="color:red;">(*)</span></label>
            <div class="col-md-8">
            <telerik:RadComboBox ID="cbType" runat="server" CssClass="col-imp-5" TabIndex="1" Width="70px" AllowCustomText="false"  OnSelectedIndexChanged="cbType_SelectedIndexChanged" AutoPostBack="true"   EmptyMessage="Chọn loại" filter="Contains">
                <Items>
                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                </Items>
                </telerik:RadComboBox>
            <%--<asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ControlToValidate="cbType" ValidationGroup="g1"
                ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>--%>
            </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label">Tên sản phẩm <span style="color:red;">(*)</span></label>
            <div class="col-md-8">
                <telerik:RadTextBox ID="txtProductName" CssClass="col-imp-10 inputForm" Width="100px" runat="server"    />
                <asp:RequiredFieldValidator  ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtProductName" ValidationGroup="g1"
                    ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
        <label class="col-md-4 control-label">Đơn vị tính<span style="color:red;">(*)</span></label>
        <div class="col-md-8">
            <telerik:RadTextBox ID="txtUnit" CssClass="col-imp-2 inputForm" Width="100px" runat="server"    />
              
            </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label">
                Hình thức <span style="color:red;">(*)</span></label>
            <div class="col-md-8">
                <telerik:RadComboBox ID="cbIsNew" runat="server" CssClass="col-imp-5" TabIndex="1" Width="70px" AllowCustomText="false"  EmptyMessage="Chọn hình thức" filter="Contains">
                    <Items>
                        <telerik:RadComboBoxItem Text="Gạo mới" Value="N" />
                        <telerik:RadComboBoxItem Text="Gạo ưa chuộng" Value="L" />
                        <telerik:RadComboBoxItem Text="Gạo bình thường" Value="A" />
                    </Items>
                </telerik:RadComboBox>
            </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label">Hình ảnh minh họa(120x120)</label>
            <div class="col-md-8">
                <asp:FileUpload ID="fuImagePath" CssClass="col-imp-10 inputForm"  runat="server"   />
                <asp:RegularExpressionValidator ID="REVUploadFile" runat="server"
                                    ControlToValidate="fuImagePath" 
                                    ErrorMessage="Chỉ được upload file dạng .gif, .jpg, .jpeg, .png"
                                    ValidationExpression="^.+\.((gif)|(jpg)|(jpeg)|(PNG)|(png)|(GIF)|(JPG)|(JPEG))$"
                                    ValidationGroup="g1"></asp:RegularExpressionValidator>
                </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-4 control-label"></label>
            <div class="col-md-5">
                <asp:Image ID="img" runat="server" Width="120" Height="120" BorderWidth="1px" Visible ="false"></asp:Image>  
                <asp:HiddenField ID="hidOldImagePath" runat="server" />
                </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
        <label class="col-md-3 control-label">Nội dung chi tiết</label>
        <div class="col-md-5">
            <telerik:RadEditor runat="server" ID="RadEditorContent" SkinID="BasicSetOfTools"  EnableResize="true" Width="500px" Height="300px" >
                        <Content></Content>
                </telerik:RadEditor> 
        </div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label"></label>
            <div class="col-md-5"></div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label"></label>
            <div class="col-md-5"></div>
        </div>
        <!--End Dòng -->
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label"></label>
            <div class="col-md-5"></div>
        </div>
        <!--End Dòng -->
        </div>
        <!--End Block bên trái -->
         <!--Block bên phải -->
     <div class="form-group col-md-6">
        <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label"></label>
            <div class="col-md-5"></div>
        </div>
        <!--End Dòng -->
         <!--Dòng -->
         <%--
        <div class="form-group">
        <label class="col-md-3 control-label">Giá (VNĐ)</label>
        <div class="col-md-8">
            <telerik:RadTextBox ID="txtPrice" CssClass="col-imp-4 inputForm" Width="100px" runat="server"  Text="0" onkeyup = "FormatNumber(this)"   />
                <asp:RequiredFieldValidator  ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtPrice" ValidationGroup="g1"
                    ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>    
            </div>
        </div>--%>
        <!--End Dòng -->
        
          <!--Dòng -->
        <div class="form-group">
        <label class="col-md-3 control-label">Loại</label>
        <div class="col-md-8">
            <telerik:RadComboBox ID="cbProductTypeID" runat="server" CssClass="col-imp-5"  Width="70px" AllowCustomText="false"  EmptyMessage="Chọn loại" filter="Contains">
                </telerik:RadComboBox>
            </div>
        </div>
        <!--End Dòng -->
         
          <!--Dòng -->
        <div class="form-group">
        <label class="col-md-3 control-label">Đặc tính</label>
        <div class="col-md-8">
            <telerik:RadComboBox ID="cbProperty" runat="server" CssClass="col-imp-5"  Width="70px" AllowCustomText="false"  EmptyMessage="Chọn đặc tính" filter="Contains">
                </telerik:RadComboBox>
            
            </div>
        </div>
        <!--End Dòng -->
         <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label">
                Khuyến mãi quà tặng<span style="color:red;">(*)</span></label>
            <div class="col-md-8">
                <telerik:RadComboBox ID="cbIsPromotion" runat="server" CssClass="col-imp-5"  AllowCustomText="false" EmptyMessage="Chọn khuyến mãi"   filter="Contains">
                    <Items>
                        <telerik:RadComboBoxItem Text="Có" Value="1" />
                        <telerik:RadComboBoxItem Text="Không" Value="0" />
                    </Items>
                </telerik:RadComboBox>
            </div>
        </div>
        <!--End Dòng -->
         <!--Dòng -->
        <div class="form-group">
        <label class="col-md-3 control-label">Thứ tự hiển thị</label>
        <div class="col-md-8">
            <telerik:RadTextBox ID="txtSortOrder" CssClass="col-imp-2 inputForm" Width="20px" runat="server"  onkeyup = "FormatNumber(this)" />
            </div>
        </div>
        <!--End Dòng -->
          <%--<!--Dòng -->
            <div class="form-group">
            <label class="col-md-3 control-label">Tình trạng</label>
            <div class="col-md-8">
                <telerik:RadTextBox ID="txtStatus" CssClass="col-imp-4 inputForm" Width="40px" runat="server" readOnly= "true" />
                </div>
        </div>
        <!--End Dòng -->--%>
     </div>
        
        <!--End Block bên phải -->
    </div>
     </fieldset>
      <!--Action-->
    <div class="set-btns text-center">            
        <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu" OnClick="btnSave_Click"   ValidationGroup="g1" />
        <%--<asp:Button ID="btnFinish" CssClass="btn btn-sm btn-primary" runat="server" Text="Hoàn thành" OnClick="btnFinish_Click"   ValidationGroup="g1" />--%>
        <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-sm btn-warning" Text="Xóa"  OnClick="btnCancel_Click" OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" />
        <asp:Button ID="btnNew" CssClass="btn btn-sm btn-primary" runat="server" Text="Tạo mới"  OnClick="btnNew_Click" />
    </div>
    <!--End Action -->
    </telerik:RadPageView>
    <!--End Tab thông tin chung -->
    <!--Tim kiem -->
    <telerik:RadPageView ID="RadPageView2" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset2">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                    <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Mã sản phẩm</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtProductCodeSearch" CssClass="col-imp-4 inputForm" runat="server" />
                        </div>
                    </div>
                  <!--End Dòng -->
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Thuộc loại</label>
                        <div class="col-md-7">
                            <telerik:RadComboBox ID="cbTypeSearch" runat="server" CssClass="col-imp-5" AllowCustomText="false" EmptyMessage="---Tất cả---" filter="Contains" OnSelectedIndexChanged="cbType_SelectedIndexChanged" AutoPostBack="true">
                                <Items>
                                    <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                    <telerik:RadComboBoxItem Text="Gạo" Value="R" />
                                    <telerik:RadComboBoxItem Text="Quà tặng" Value="P" />
                                </Items>
                            </telerik:RadComboBox>
                        </div>
                    </div>
                  <!--End Dòng -->
                  <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Tên sản phẩm</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtProductNameSearch" CssClass="col-imp-10 inputForm" runat="server" />
                        </div>
                    </div>
                  <!--End Dòng -->
                     
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Hình thức</label>
                        <div class="col-md-7">
                            <telerik:RadComboBox ID="cbIsNewSearch" runat="server" CssClass="col-imp-5"  Width="70px" AllowCustomText="false"  EmptyMessage="---Tất cả---" filter="Contains">
                            <Items>
                                <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                                <telerik:RadComboBoxItem Text="Gạo mới" Value="N" />
                                <telerik:RadComboBoxItem Text="Gạo ưa chuộng" Value="L" />
                                <telerik:RadComboBoxItem Text="Gạo bình thường" Value="A" />
                            </Items>
                        </telerik:RadComboBox>
                        </div>
                         </div>
                  <!--End Dòng -->
                </div>
                 <!--End Block bên trái -->
                     <!--Block bên phải -->
                <div class="form-group col-md-6">
                    <%--<!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Từ ngày</label>
                        <div class="col-md-8">
                          <telerik:RadDatePicker ID="rtpFromDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB"  DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar3" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Đến ngày</label>
                        <div class="col-md-8">
                            <telerik:RadDatePicker ID="rtpToDateSearch" cssclass="col-imp-8" enabled="true" runat="server" Culture="en-GB" DateFormat="dd/MM/yyyy" readOnly ="true">
                                <Calendar ID="Calendar4" runat="server" EnableKeyboardNavigation="true" ViewSelectorText="x" Skin="Hay" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False">
                                </Calendar>
                                <DateInput  style="width:200px" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy"  readOnly ="true"></DateInput>
                            </telerik:RadDatePicker>
                         </div>
                    </div>
                    <!--End Dòng -->--%>
                    <!--Dòng -->
        <div class="form-group">
            <label class="col-md-3 control-label">
               Khuyến mãi quà tặng</label>
            <div class="col-md-8">
                <telerik:RadComboBox ID="cbIsPromotionSearch" runat="server" CssClass="col-imp-5"  AllowCustomText="false" EmptyMessage="---Tất cả---"   filter="Contains">
                    <Items>
                        <telerik:RadComboBoxItem Text="---Tất cả---" Value="" />
                        <telerik:RadComboBoxItem Text="Có" Value="1" />
                        <telerik:RadComboBoxItem Text="Không" Value="0" />
                    </Items>
                </telerik:RadComboBox>
            </div>
        </div>
        <!--End Dòng -->
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">Loại</label>
                        <div class="col-md-8">
                            <telerik:RadComboBox ID="cbProductTypeSearch" runat="server" CssClass="col-imp-5" TabIndex="1" Width="70px" AllowCustomText="false"  EmptyMessage="---Tất cả---" filter="Contains">
                </telerik:RadComboBox>
                         </div>
                    </div>
                    <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
                </div>
                <!--Button Tim Kiem-->
                 <div class="set-btns text-center">
                     <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" OnClick="btnSearch_Click" Text="Tìm kiếm"  />
                     <asp:Button ID="btnExport" CssClass="btn btn-sm btn-primary" runat="server" OnClick="btnExport_Click"  Text="Xuất excel"  />
                </div> 
                <!--End Button Tim Kiem--> 
                  <!--Grid data-->
            <div class="row">
               <div style="float: left;font-weight:bold" runat="server" id="div_TotalRows" >&nbsp;Kết quả tìm kiếm: 0</div>
               <div style="float: right;"><asp:Button ID="btnRefresh" CssClass="btnRefresh" ToolTip="Refresh" runat="server" OnClick="btnRefresh_Click" Text="Refresh"  /></div> 
            <telerik:radgrid id="gvData" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" PageSize="10" AllowCustomPaging="true"
                allowmultirowselection="True" headerstyle-borderstyle="None"  ShowHeader="true" Height="250" OnNeedDataSource="gvData_NeedDataSource"  OnItemCommand="gvData_ItemCommand">
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10" EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" DataField="RowID" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn  DataField="ProductCode" UniqueName="ProductCode"  ReadOnly="true" HeaderText="Mã sản phẩm">
                        <HeaderStyle HorizontalAlign="Center"  Width="80px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Tên sản phẩm">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="Type" UniqueName="Type"  ReadOnly="true" HeaderText="Thuộc loại">
                        <HeaderStyle HorizontalAlign="Center"  Width="80px"/>
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="IsNewName" UniqueName="IsNewName"  ReadOnly="true" HeaderText="Hình thức">
                        <HeaderStyle HorizontalAlign="Center"  Width="80px"/>
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="ProductTypeName" UniqueName="ProductTypeName"  ReadOnly="true" HeaderText="Loại">
                        <HeaderStyle HorizontalAlign="Center"  Width="80px"/>
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="ProductTypeName1" UniqueName="ProductTypeName1"  ReadOnly="true" HeaderText="Thuộc tính">
                        <HeaderStyle HorizontalAlign="Center"  Width="150px"/>
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="IsPromotionName" UniqueName="IsPromotionName"  ReadOnly="true" HeaderText="Khuyến mãi quà tặng">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px"/>
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="SortOrder" UniqueName="SortOrder"  ReadOnly="true" HeaderText="Vị trí hiển thị">
                        <HeaderStyle HorizontalAlign="Center"  Width="50px" />
                        <ItemStyle HorizontalAlign="Right" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Chi tiết" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnEdit" CssClass="btnViewDetail" CommandArgument='<%# Eval("ProductID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="50px" />
                        <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="btnDelete" CssClass="btnX" CommandArgument='<%# Eval("ProductID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data-->  
                </fieldset>
    </telerik:RadPageView>
    <!--End Tab Tim kiem -->
    <!--Dinh nghia gia ban -->
    <telerik:RadPageView ID="RadPageView3" runat="server"  Style="overflow: hidden">
                 <fieldset class="form" id="Fieldset1">
                  <br />
                <div class="form-horizontal wrapper-center clearfix">
                    <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                         <label class="col-md-4 control-label">
                            Sản phẩm<span style="color:red;">(*)</span></label>
                        <div class="col-md-7">
                            <telerik:RadComboBox ID="cbProduct" runat="server" CssClass="col-imp-7" AllowCustomText="false" ValidationGroup="g3" >
                                
                            </telerik:RadComboBox>
                            <asp:RequiredFieldValidator  ID="RequiredFieldValidator2" runat="server" ControlToValidate="cbProduct" ValidationGroup="g3"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                        </div>
                    </div>
                  <!--End Dòng -->
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-4 control-label">
                            Giá bán(VNĐ) <span style="color:red;">(*)</span></label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtPrice" CssClass="col-imp-4 inputForm" runat="server" onkeyup = "FormatNumber(this)"  ValidationGroup="g3"/>
                            <asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPrice" ValidationGroup="g3"
                           ErrorMessage="Required(*)" InitialValue=""></asp:RequiredFieldValidator>
                        </div>
                       
                    </div>
                  <!--End Dòng -->
                    
                </div>
                 <!--End Block bên trái -->
                     <!--Block bên phải -->
                    <div class="form-group col-md-6">
                    <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tỉnh/thành phố <span style="color:red;">(*)</span></label>
                        <div class="col-md-8">
                           
                              <telerik:RadListBox ID="rlbLocation" runat="server" CheckBoxes="true" ShowCheckAll="true" Width="220px"
                Height="150px" ></telerik:RadListBox>
                        </div>
                         </div>
                  <!--End Dòng -->
                  <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Người cập nhật cuối</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtLastUpdatedBy" CssClass="col-imp-4 inputForm" runat="server" readonly="true"  />
                        </div>
                         </div>
                  <!--End Dòng -->
                         <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Ngày cập nhật cuối</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtLastUpdatedDateTime" CssClass="col-imp-4 inputForm" runat="server" readonly="true"   />
                        </div>
                         </div>
                  <!--End Dòng -->
                </div>
                 <!--End Block bên phải -->
                </div>
                     
                <!--Button Tim Kiem-->
                 <div class="set-btns text-center">
                     <asp:Button ID="btnSavePrice" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu"  OnClick="btnSavePrice_Click" ValidationGroup="g3"/>
                     <asp:Button ID="btnSearchPrice" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm kiếm"  OnClick="btnSearchPrice_Click" />
                     <asp:Button ID="btnNewPrice" CssClass="btn btn-sm btn-primary" runat="server" Text="Tạo mới" OnClick="btnNewPrice_Click" />
                </div> 
                <!--End Button Tim Kiem--> 
                  <!--Grid data-->
            <center>
                     <div class="row">&nbsp;
               <div style="float: left;font-weight:bold;width:620px" runat="server" id="div_TotalPrice" >Kết quả tìm kiếm: 0</div>
                <br />
            <telerik:radgrid id="gv_Price" runat="server" cellspacing="0" cssclass=" table table-bordered"
                gridlines="None" autogeneratecolumns="False" headerstyle-horizontalalign="Center" 
                allowmultirowselection="True" headerstyle-borderstyle="None"  Width="800px" ShowHeader="true" Height="250" AllowPaging="True" PageSize="10" OnNeedDataSource="gv_Price_NeedDataSource"  OnItemCommand="gv_Price_ItemCommand">
                
                <MasterTableView ShowHeader="true" NoMasterRecordsText="Không có dữ liệu." ShowGroupFooter="true" AllowPaging="True" PageSize="10"  EditMode="InPlace">
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
                 <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                <Columns>
                    <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                             <%# Eval("RowID") %></ItemTemplate>
                        <HeaderStyle Width="30px" />
                        <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                     <telerik:GridBoundColumn  DataField="ProductName" UniqueName="ProductName"  ReadOnly="true" HeaderText="Tên sản phẩm">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Giá bán(VNĐ)" UniqueName="Price" DataField="Price">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0:N0}", float.Parse(Eval("Price").ToString()))%>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" Width="100px" />
                            <ItemStyle HorizontalAlign="Right" Width="100px" />
                    </telerik:GridTemplateColumn>
                     <telerik:GridBoundColumn  DataField="LocationName" UniqueName="LocationName"  ReadOnly="true" HeaderText="Tỉnh/thành">
                        <HeaderStyle HorizontalAlign="Center"  Width="100px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn HeaderText="Chi tiết" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button3" CssClass="btnViewDetail" CommandArgument='<%# Eval("DefinitionPriceID") %>'
                                CommandName="EditItem" runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" Width="30px" />
                        <ItemStyle HorizontalAlign="Center" ></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Xóa" Visible=true HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Button ID="Button4" CssClass="btnX" CommandArgument='<%# Eval("DefinitionPriceID") %>'
                                OnClientClick="return ConfirmOnDelete('Bạn chắc chắn muốn xóa không?')" CommandName="DeleteItem"
                                runat="server"></asp:Button>
                        </ItemTemplate>
                        <HeaderStyle Width="30px"/>
                            <ItemStyle HorizontalAlign="Center" />
                    </telerik:GridTemplateColumn>
                </Columns>
                </MasterTableView>
            </telerik:radgrid>
        </div>
            <!--End Grid data-->
                </center>  
                </fieldset>
    </telerik:RadPageView>
    <!--End Tab Dinh nghia gia ban -->
    </telerik:RadMultiPage>
    
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
<asp:PostBackTrigger ControlID="btnExport" />
</Triggers>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
<script>
    function FormatNumber(obj) {

        var x;

        if (eval(obj))

            x = eval(obj).value;

        else

            x = obj;

        var num = x.replace(/$|,/g, '');

        if (isNaN(num)) { num = ""; }

        sign = (num == (num = Math.abs(num)));

        num = Math.floor(num * 100 + 0.50000000001);

        num = Math.floor(num / 100).toString();

        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3) ; i++) {

            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));

        }

        eval(obj).value = num;

    }
</script>